package practite;

import java.nio.charset.StandardCharsets;
import java.util.Arrays;

public class UTF8 {
    public static void main(String[] args) throws Exception {
        String a = "abdfid适度符合2UI速度和南方";
        byte[] b = a.getBytes("UTF-8");
//        System.out.println(Arrays.toString(b));
        String c = new String(b, StandardCharsets.UTF_8);
        System.out.println(c);
        System.out.println(b.length);
        for (int i = 0; i < a.length(); i++) {
            char m = a.charAt(i);
            System.out.print(m);
            System.out.print(";");
            System.out.println(Integer.toBinaryString(m));
        }
        for(byte b1:b){
            System.out.println(Integer.toBinaryString(b1&0xff));
        }
    }
}
